from tkinter import *
import random
root = Tk()

cv=Canvas(root,bg='green')
cv.create_rectangle(10,10,110,110)
cv.pack()
def draw():

    a = random.randint(0,100)
    b = random.randint(0, 100)
    w = random.randint(30, 300)
    h = random.randint(300, 300)
    rect = cv.create_rectangle(a,b,w,h,width=3)
bt = Button(root,text='Draw',command=draw)
bt.pack()

root.mainloop()